﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="imgLink.aspx.cs" Inherits="GDIT.page.manage.link.imgLink" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link href="../../../css/m_imgLink.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div class="all">


<!--图片布阵开始-->
<div class="imgsNav">
    <div class="titleImg">新闻图片</div>
    <div class="divide"></div>
    <ul class="imgsUl imgsUl1">
        <asp:Repeater ID="NewsRepeater" runat="server">
            <ItemTemplate>
                <li><img alt="<%#DataBinder.Eval(Container.DataItem, "OID") %>|../../../<%#DataBinder.Eval(Container.DataItem, "PicPath") %>|<%#DataBinder.Eval(Container.DataItem, "LinkAddress") %>|<%#DataBinder.Eval(Container.DataItem, "Visible") %>|<%#DataBinder.Eval(Container.DataItem, "Alt") %>" src="../../../<%#DataBinder.Eval(Container.DataItem, "PicPath") %>" /></li>
            </ItemTemplate>
        </asp:Repeater>
    </ul>
    <div class="titleImg">重点图片</div>
    <div class="divide"></div>
    <ul class="imgsUl imgsUl2">
        <asp:Repeater ID="ImportantRepeater" runat="server">
            <ItemTemplate>
                <li><img alt="<%#DataBinder.Eval(Container.DataItem, "OID") %>|../../../<%#DataBinder.Eval(Container.DataItem, "PicPath") %>|<%#DataBinder.Eval(Container.DataItem, "LinkAddress") %>|<%#DataBinder.Eval(Container.DataItem, "Visible") %>|<%#DataBinder.Eval(Container.DataItem, "Alt") %>" src="../../../<%#DataBinder.Eval(Container.DataItem, "PicPath") %>" /></li>
            </ItemTemplate>
        </asp:Repeater>
    </ul>
    <div class="titleImg">导航图片</div>
    <div class="divide"></div>
    <ul class="imgsUl imgsUl3">
        <asp:Repeater ID="NavRepeater" runat="server">
            <ItemTemplate>
                <li><img alt="<%#DataBinder.Eval(Container.DataItem, "OID") %>|../../../<%#DataBinder.Eval(Container.DataItem, "PicPath") %>|<%#DataBinder.Eval(Container.DataItem, "LinkAddress") %>|<%#DataBinder.Eval(Container.DataItem, "Visible") %>|<%#DataBinder.Eval(Container.DataItem, "Alt") %>" src="../../../<%#DataBinder.Eval(Container.DataItem, "PicPath") %>" /></li>
            </ItemTemplate>
        </asp:Repeater>
    </ul>
</div>
<script type="text/javascript">
    function Ready() {
        var imgs = new Array();  //图片集合
        var close;//弹出的透明层
        var alls = document.getElementsByTagName("*");
        for (var i = 0; i < alls.length; i++) {
            if (alls[i].tagName == "IMG") {
                imgs[imgs.length] = alls[i];
                alls[i].onclick = imgs_onclick;
            } else if (alls[i].className == "close") {
                close = alls[i];
                close.onclick = ClosePopup;
            }
        }
    }

    Ready();

    function imgs_onclick() {
        var popupOut; //弹出的透明层
        var popupInner; //弹出的内容层
        var txtId;//隐藏的图片id
        var txtPath;//图片路径
        var txtAddress;//图片链接
        var chkVisible;//图片是否可见
        var imgImg; //图片
        var lblAlt;//图片描述的标题
        var txtAlt;//图片描述
        var alls = document.getElementsByTagName("*");
        for (var i = 0; i < alls.length; i++) {
            if (alls[i].className == "popupOut") {
                popupOut = alls[i];
            } else if (alls[i].className == "popupInner") {
                popupInner = alls[i];
            } else if (alls[i].className == "id") {
                txtId = alls[i];
            } else if (alls[i].className == "path") {
                txtPath = alls[i];
            } else if (alls[i].className == "address") {
                txtAddress = alls[i];
            } else if (alls[i].className == "visible") {
                chkVisible = alls[i];
            } else if (alls[i].className == "img") {
                imgImg = alls[i];
            } else if (alls[i].className == "alt") {
                txtAlt = alls[i];
            } else if (alls[i].className == "lblAlt") {
                lblAlt = alls[i];
            }
        }
        popupOut.style.display = "block";
        popupInner.style.display = "block";
        txtId.style.visibility = "";
        txtId.value = PartitionAlt(this.alt, 0);
        txtId.style.visibility = "hidden";
        //txtPath.value = "";
        txtAddress.value = PartitionAlt(this.alt, 2);
        chkVisible.getElementsByTagName("INPUT")[0].checked = "checked";
        imgImg.src = PartitionAlt(this.alt, 1);
        if (this.parentNode.parentNode.className.indexOf("imgsUl1") > 0) {
            imgImg.style.width = "250px";
            imgImg.style.height = "160px";
            txtAlt.style.visibility = "hidden";
            lblAlt.style.visibility = "hidden";
        } else if (this.parentNode.parentNode.className.indexOf("imgsUl2") > 0) {
            imgImg.style.width = "300px";
            imgImg.style.height = "46px";
        } else if (this.parentNode.parentNode.className.indexOf("imgsUl3") > 0) {
            imgImg.style.width = "140px";
            imgImg.style.height = "50px";
        }
        txtAlt.value = PartitionAlt(this.alt, 4);
    }

    //以上代码成功

    function ClosePopup() {
        var popupOut;//弹出的透明层
        var popupInner;//弹出的内容层
        var alls = document.getElementsByTagName("*");
        for (var i = 0; i < alls.length; i++) {
            if (alls[i].className == "popupOut") {
                popupOut = alls[i];
            } else if (alls[i].className == "popupInner") {
                popupInner = alls[i];
            }
        }
        popupOut.style.display = "none";
        popupInner.style.display = "none";
    }

    function PartitionAlt(alt, i) {
        var hrefs = new Array();
        alts = alt.split("|");
        return alts[i];
    }
</script>
<!--图片布阵结束-->



<!--弹出层开始-->
<div class="popupOut"></div>
<div class="popupInner">
    <asp:TextBox ID="txtId" runat="server" CssClass="id"></asp:TextBox>
    
    <span class="lblAddress">图片地址:</span>
    <asp:TextBox ID="txtAddress" runat="server" CssClass="address" TextMode="MultiLine"></asp:TextBox>
    
    <span class="lblVisible">是否可见</span>
    <asp:CheckBox ID="chkVisible" runat="server" CssClass="visible" />
    
    <span class="lblImg">图片预览:</span>
    <asp:Image ID="ShowImage" runat="server" CssClass="img" />
   
    <span class="lblAlt">图片描述:</span>
    <asp:TextBox ID="txtAlt" runat="server" CssClass="alt" TextMode="MultiLine"></asp:TextBox>
    
    <asp:FileUpload ID="filPath" runat="server" CssClass="path" />

    <asp:LinkButton ID="btnSave" runat="server" CssClass="save" OnClick="btnSave_OnClick">保存修改</asp:LinkButton>
    <a href="javascript:void(0);" onclick="ClosePopup();" class="close"></a>
</div>
<!--弹出层结束-->


</div>
</form>
</body>
</html>
